#version 130

uniform mat4 projection_matrix;
uniform mat4 modelview_matrix;

in vec4 Position;
in vec4 Velocity;
in float Life;

out vec3 vPosition;
out vec3 vVelocity;
out float vLife;
out float gl_PointSize;

const float point_size = 75.0f;

void main(void) 
{
	//color = vec4( 1.0f, 1.0f, 0.0f, 1.0f );

	gl_Position = projection_matrix * modelview_matrix * Position;
	
	if ( Life > 0.0f )
	{
		gl_PointSize = ( point_size / gl_Position.w ) * Life;
	}
	else
	{
		gl_PointSize = ( point_size / gl_Position.w ) * -Life;
	}
	
	vPosition = Position.xyz;
	vVelocity = Velocity.xyz;
	
	vLife = Life;
}
